//
//  ikarosMacros.m
//  ikarosKit
//
//  Created by rui on 2024/10/22.
//

#import "ikarosMacros.h"
#import <UIKit/UIKit.h>
#import "JRBaseView.h"

FOUNDATION_EXTERN_INLINE NSString * _Nullable ikaroKitVersion(void) {
    return [[NSBundle bundleForClass:JRBaseView.class].infoDictionary valueForKey:@"CFBundleShortVersionString"];
}

FOUNDATION_EXTERN_INLINE NSString * _Nullable ikaroKitBuildVersion(void) {
    return [[NSBundle bundleForClass:JRBaseView.class].infoDictionary valueForKey:(id)kCFBundleVersionKey];
}

FOUNDATION_EXTERN_INLINE CGFloat kJRScreenWidth(void) {
    return ([[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] ? [UIScreen mainScreen].nativeBounds.size.width/[UIScreen mainScreen].nativeScale : [UIScreen mainScreen].bounds.size.width);
}

FOUNDATION_EXTERN_INLINE CGFloat kJRScreenHeight(void) {
    return ([[UIScreen mainScreen] respondsToSelector:@selector(nativeBounds)] ? [UIScreen mainScreen].nativeBounds.size.height/[UIScreen mainScreen].nativeScale : [UIScreen mainScreen].bounds.size.height);
}

FOUNDATION_EXTERN_INLINE CGFloat kJRWidthRadio(CGFloat width) {
    return width * (kJRScreenWidth() / 375.0);
}

FOUNDATION_EXTERN_INLINE CGFloat kJRHeightRadio(CGFloat height) {
    return height * (kJRScreenHeight() / 667.0);
}
